package com.yonyougov.devops.cruxcisupport.util;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class JSONUtils {
    private static ObjectMapper objectMapper = new ObjectMapper();

    @SneakyThrows
    public static String toJSONString(Object object){
        return objectMapper.writeValueAsString(object);
//        return JSONObject.fromObject(object).toString();
    }

    @SneakyThrows
    public static Object parse(String json,Class beanClass){
        return objectMapper.readValue(json,beanClass);
//        return JSONObject.toBean(JSONObject.fromObject(json),beanClass);
    }

}
